﻿@model GreenGrass.Models.UserProfile[]
@{
    ViewBag.Title = "Управление Учетными записями";
}     


<h2>
    title</h2>
<table>
    <thead>
        <tr>
            <td>
                ID
            </td>
            <td>
                Имя пользователя
            </td>
            <td>
                Роли
            </td>
        </tr>
    </thead>
    <tbody>
        @foreach (var u in Model)
        {
            <tr>
                <td>@u.UserId
                </td>
                <td>
                    @Html.ActionLink(u.UserName, "GetUser", "AccountManagement", new { id = u.UserId },null)
                </td>
                <td>
                    @{ string roles = ""; }
                    @foreach (var r in u.UserRoles)
                    {
                        roles += r.RoleName + ", ";
                    }
                    @{
                    roles = roles.Length > 1 ? roles.Remove(roles.Length - 1) : "";
                    ;
                    }
                    @roles
                </td>
            </tr>
        }
    </tbody>
</table>
@*<script type="text/javascript">
    function UserModel(id, name) {
        var self = this;
    }

    function UserListVM() {
        var self = this;
        


        
    }

    ko.applyBindings(new UserListVM());
</script>   *@